package com.gpsnav.ui;
import net.rim.device.api.ui.component.ObjectChoiceField;
import net.rim.device.api.ui.*;
import com.gpsnav.bo.Options;

public class ResizableChoiceField extends ObjectChoiceField {
    private String[] dccChoices;
   public ResizableChoiceField(String l, String[] c, int i, long style) {
        super(l,c,i, style);
        dccChoices = c;
    }

    protected void layout(int width, int height)  {
        int w = 1;
        for (int i=0;i<dccChoices.length;i++) {
            int v = getFont().getAdvance(dccChoices.toString());
            w = Math.max(w,v);
        }
       super.layout(w,height);
//       super.layout(w+3,height);
//        super.layout(20,height);
    }
//    protected void paintBackground(Graphics g) {
//        if (Options.getNightMode()) {
//            g.setBackgroundColor(Color.BLACK);
//            g.setColor(Color.RED);
//        } else {
//            g.setBackgroundColor(Color.WHITE);
//            g.setColor(Color.BLACK);
//        }
//        g.clear();
//        g.fillRect(0,0,Graphics.getScreenWidth(), Graphics.getScreenHeight());
//    }
}
